{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\Anaconda\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3063: DtypeWarning: Columns (6) have mixed types.Specify dtype option on import or set low_memory=False.\n",
      "  interactivity=interactivity, compiler=compiler, result=result)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1001731 entries, 0 to 1001730\n",
      "Data columns (total 16 columns):\n",
      " #   Column             Non-Null Count    Dtype  \n",
      "---  ------             --------------    -----  \n",
      " 0   cmte_id            1001731 non-null  object \n",
      " 1   cand_id            1001731 non-null  object \n",
      " 2   cand_nm            1001731 non-null  object \n",
      " 3   contbr_nm          1001731 non-null  object \n",
      " 4   contbr_city        1001712 non-null  object \n",
      " 5   contbr_st          1001727 non-null  object \n",
      " 6   contbr_zip         1001620 non-null  object \n",
      " 7   contbr_employer    988002 non-null   object \n",
      " 8   contbr_occupation  993301 non-null   object \n",
      " 9   contb_receipt_amt  1001731 non-null  float64\n",
      " 10  contb_receipt_dt   1001731 non-null  object \n",
      " 11  receipt_desc       14166 non-null    object \n",
      " 12  memo_cd            92482 non-null    object \n",
      " 13  memo_text          97770 non-null    object \n",
      " 14  form_tp            1001731 non-null  object \n",
      " 15  file_num           1001731 non-null  int64  \n",
      "dtypes: float64(1), int64(1), object(14)\n",
      "memory usage: 122.3+ MB\n"
     ]
    }
   ],
   "source": [
    "# 真实世界的数据集\n",
    "# 对于每一个数据集，用各种方法，从原始数据中提取有意义的内容\n",
    "\n",
    "# the case 5\n",
    "# the dataset fec comes form the fec.org\n",
    "\n",
    "# the overview of the dataset\n",
    "\n",
    "# 2012联邦选举委员会数据库\n",
    "\n",
    "# 美国联邦选举委员会发布了有关政治竞选赞助方面的数据\n",
    "#    其中包括赞助者的姓名、 职业、 雇主、地址以及出资额等信息\n",
    "\n",
    "# 对 2012 年美国总统大选的数据集比较感兴趣 （http://www.fec.gov/disclosurep/PDownload.do）\n",
    "#   在 2012 年 6 月下载的数据集是一个 150MB 的CSV文件（P00000001-ALL.csv）， \n",
    "# 用 pandas.read_csv 将其加载进来\n",
    "\n",
    "dataset_path = './../dataset/'\n",
    "\n",
    "import pandas as pd\n",
    "\n",
    "fec = pd.read_csv(dataset_path + 'fec/P00000001-ALL.csv')\n",
    "\n",
    "fec.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "cmte_id                             C00431445\n",
       "cand_id                             P80003338\n",
       "cand_nm                         Obama, Barack\n",
       "contbr_nm                         ELLMAN, IRA\n",
       "contbr_city                             TEMPE\n",
       "contbr_st                                  AZ\n",
       "contbr_zip                          852816719\n",
       "contbr_employer      ARIZONA STATE UNIVERSITY\n",
       "contbr_occupation                   PROFESSOR\n",
       "contb_receipt_amt                          50\n",
       "contb_receipt_dt                    01-DEC-11\n",
       "receipt_desc                              NaN\n",
       "memo_cd                                   NaN\n",
       "memo_text                                 NaN\n",
       "form_tp                                 SA17A\n",
       "file_num                               772372\n",
       "Name: 123456, dtype: object"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 该 DataFrame 中的记录\n",
    "fec.iloc[123456]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Bachmann, Michelle', 'Romney, Mitt', 'Obama, Barack',\n",
       "       \"Roemer, Charles E. 'Buddy' III\", 'Pawlenty, Timothy',\n",
       "       'Johnson, Gary Earl', 'Paul, Ron', 'Santorum, Rick',\n",
       "       'Cain, Herman', 'Gingrich, Newt', 'McCotter, Thaddeus G',\n",
       "       'Huntsman, Jon', 'Perry, Rick'], dtype=object)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 可能已经想出了许多办法从这些竞选赞助数据中抽取有关赞助人和赞助模式的统计信息\n",
    "\n",
    "# 几种不同的分析工作\n",
    "\n",
    "# 不难看出，该数据中没有党派信息，因此最好将它加进去\n",
    "# 通过 unique ，可以获取全部的候选人名单\n",
    "\n",
    "unique_cands = fec.cand_nm.unique()\n",
    "\n",
    "unique_cands"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Obama, Barack'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "unique_cands[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 指明党派信息的方法之一是使用字典\n",
    "parties = {'Bachmann, Michelle': 'Republican',\n",
    "           'Cain, Herman': 'Republican',\n",
    "           'Gingrich, Newt': 'Republican',\n",
    "           'Huntsman, Jon': 'Republican',\n",
    "           'Johnson, Gary Earl': 'Republican',\n",
    "           'McCotter, Thaddeus G': 'Republican',\n",
    "           'Obama, Barack': 'Democrat',\n",
    "           'Paul, Ron': 'Republican',\n",
    "           'Pawlenty, Timothy': 'Republican',\n",
    "           'Perry, Rick': 'Republican',\n",
    "           \"Roemer, Charles E. 'Buddy' III\": 'Republican',\n",
    "           'Romney, Mitt': 'Republican',\n",
    "           'Santorum, Rick': 'Republican'}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "123456    Obama, Barack\n",
       "123457    Obama, Barack\n",
       "123458    Obama, Barack\n",
       "123459    Obama, Barack\n",
       "123460    Obama, Barack\n",
       "Name: cand_nm, dtype: object"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 现在，通过这个映射以及 Series 对象的 map 方法\n",
    "# 可以根据候选人姓名得到一组党派信息\n",
    "fec.cand_nm[123456:123461]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "123456    Democrat\n",
       "123457    Democrat\n",
       "123458    Democrat\n",
       "123459    Democrat\n",
       "123460    Democrat\n",
       "Name: cand_nm, dtype: object"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fec.cand_nm[123456:123461].map(parties)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Democrat      593746\n",
       "Republican    407985\n",
       "Name: party, dtype: int64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# add it as a column\n",
    "fec['party'] = fec.cand_nm.map(parties)\n",
    "\n",
    "fec['party'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True     991475\n",
       "False     10256\n",
       "Name: contb_receipt_amt, dtype: int64"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 这里需要注意地方\n",
    "# 第一，该数据既包括赞助也包括退款（负的出资额）\n",
    "\n",
    "(fec.contb_receipt_amt > 0).value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 为了简化分析过程，限定该数据集只能有正的出资额\n",
    "\n",
    "fec = fec[fec.contb_receipt_amt > 0]\n",
    "\n",
    "# 由于 Barack Obama 和 Mitt Romney 是最主要的两名候选人\n",
    "#   所有专门准备一个子集，只包含针对他们两人的竞选活动赞助信息\n",
    "\n",
    "fec_mrbo = fec[fec.cand_nm.isin(['Obama, Barack', 'Romney, Mitt'])]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RETIRED                                   233990\n",
       "INFORMATION REQUESTED                      35107\n",
       "ATTORNEY                                   34286\n",
       "HOMEMAKER                                  29931\n",
       "PHYSICIAN                                  23432\n",
       "INFORMATION REQUESTED PER BEST EFFORTS     21138\n",
       "ENGINEER                                   14334\n",
       "TEACHER                                    13990\n",
       "CONSULTANT                                 13273\n",
       "PROFESSOR                                  12555\n",
       "Name: contbr_occupation, dtype: int64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 根据职业和雇主统计赞助信息\n",
    "\n",
    "# 基于职业的赞助信息统计是另一种经常被研究的统计任务\n",
    "# 例如，律师们更倾向于资助民主党，而企业家则更倾向于资助共和党\n",
    "\n",
    "# 首先，根据职业计算出资总额\n",
    "fec.contbr_occupation.value_counts()[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 不难看出，许多职业都涉及相同的基本工作类型，或者同一样东西有多种变体\n",
    "\n",
    "# 已下代码清理一些这样的数据（将一个职业信息映射到另一个）\n",
    "# 注意，这里巧妙地利用了 dict.get 它允许没有映射关系的职业也能 “ 通过 ”\n",
    "occ_mapping = {\n",
    "    'INFORMATION REQUESTED PER BEST EFFORTS' : 'NOT PROVIDED',\n",
    "    'INFORMATION REQUESTED' : 'NOT PROVIDED',\n",
    "    'INFORMATION REQUESTED (BEST EFFORTS)' : 'NOT PROVIDED',\n",
    "    'C.E.O.': 'CEO'} \n",
    "\n",
    "# If no mapping provided, return x\n",
    "f = lambda x: occ_mapping.get(x, x)\n",
    "\n",
    "fec.contbr_occupation = fec.contbr_occupation.map(f)\n",
    "\n",
    "\n",
    "# 对雇主信息也进行了同样的处理：\n",
    "emp_mapping = {\n",
    "    'INFORMATION REQUESTED PER BEST EFFORTS' : 'NOT PROVIDED',\n",
    "    'INFORMATION REQUESTED' : 'NOT PROVIDED',\n",
    "    'SELF' : 'SELF-EMPLOYED',\n",
    "    'SELF EMPLOYED' : 'SELF-EMPLOYED',} \n",
    "\n",
    "# If no mapping provided, return x\n",
    "f = lambda x: emp_mapping.get(x, x)\n",
    "\n",
    "fec.contbr_employer = fec.contbr_employer.map(f)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>party</th>\n",
       "      <th>Democrat</th>\n",
       "      <th>Republican</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>contbr_occupation</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>ATTORNEY</th>\n",
       "      <td>11141982.97</td>\n",
       "      <td>7.477194e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CEO</th>\n",
       "      <td>2074974.79</td>\n",
       "      <td>4.211041e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CONSULTANT</th>\n",
       "      <td>2459912.71</td>\n",
       "      <td>2.544725e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ENGINEER</th>\n",
       "      <td>951525.55</td>\n",
       "      <td>1.818374e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>EXECUTIVE</th>\n",
       "      <td>1355161.05</td>\n",
       "      <td>4.138850e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HOMEMAKER</th>\n",
       "      <td>4248875.80</td>\n",
       "      <td>1.363428e+07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>INVESTOR</th>\n",
       "      <td>884133.00</td>\n",
       "      <td>2.431769e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LAWYER</th>\n",
       "      <td>3160478.87</td>\n",
       "      <td>3.912243e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MANAGER</th>\n",
       "      <td>762883.22</td>\n",
       "      <td>1.444532e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NOT PROVIDED</th>\n",
       "      <td>4866973.96</td>\n",
       "      <td>2.056547e+07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OWNER</th>\n",
       "      <td>1001567.36</td>\n",
       "      <td>2.408287e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PHYSICIAN</th>\n",
       "      <td>3735124.94</td>\n",
       "      <td>3.594320e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PRESIDENT</th>\n",
       "      <td>1878509.95</td>\n",
       "      <td>4.720924e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PROFESSOR</th>\n",
       "      <td>2165071.08</td>\n",
       "      <td>2.967027e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>REAL ESTATE</th>\n",
       "      <td>528902.09</td>\n",
       "      <td>1.625902e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>RETIRED</th>\n",
       "      <td>25305116.38</td>\n",
       "      <td>2.356124e+07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SELF-EMPLOYED</th>\n",
       "      <td>672393.40</td>\n",
       "      <td>1.640253e+06</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "party                 Democrat    Republican\n",
       "contbr_occupation                           \n",
       "ATTORNEY           11141982.97  7.477194e+06\n",
       "CEO                 2074974.79  4.211041e+06\n",
       "CONSULTANT          2459912.71  2.544725e+06\n",
       "ENGINEER             951525.55  1.818374e+06\n",
       "EXECUTIVE           1355161.05  4.138850e+06\n",
       "HOMEMAKER           4248875.80  1.363428e+07\n",
       "INVESTOR             884133.00  2.431769e+06\n",
       "LAWYER              3160478.87  3.912243e+05\n",
       "MANAGER              762883.22  1.444532e+06\n",
       "NOT PROVIDED        4866973.96  2.056547e+07\n",
       "OWNER               1001567.36  2.408287e+06\n",
       "PHYSICIAN           3735124.94  3.594320e+06\n",
       "PRESIDENT           1878509.95  4.720924e+06\n",
       "PROFESSOR           2165071.08  2.967027e+05\n",
       "REAL ESTATE          528902.09  1.625902e+06\n",
       "RETIRED            25305116.38  2.356124e+07\n",
       "SELF-EMPLOYED        672393.40  1.640253e+06"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 现在，可以通过 pivot_table 根据党派和职业对数据进行聚合\n",
    "#    然后过滤掉总出资额不足 200 万美元的数据\n",
    "\n",
    "by_occupation = fec.pivot_table('contb_receipt_amt',\n",
    "                                index='contbr_occupation',\n",
    "                                columns='party', aggfunc='sum')\n",
    "\n",
    "over_2mm = by_occupation[by_occupation.sum(1) > 2000000]\n",
    "\n",
    "over_2mm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0xa47a288>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcQAAAEFCAYAAAB965cOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3debxd0/3/8ddbDKEhSvgWUddcTUQSMWsJirYpglZirrHG4id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QCBK/OfueN5N0l3jyAh4/wr1DCFW18sorc+WVV3LppZdim1mzZjFgwAA22WQTunXrxl//+lcARo4cyTbbbMMvfvEL1ltvPU4++WRuvPFGNt10UzbccMM5iTWvv/4622+/Pd26dWP77bfnjTfeAODdd9+lb9++bLTRRmy00UaMGjWKKVOmsMEGG3DkkUfSs2dP3nzzTY444gh69epFly5dOP300wEYPHgwb7/9Nr1796Z37941+120xA5xElBqMa1JwDzpApLWIq1iPydUz3ah0/lNvq6TJ22fB/QD9sg2fQh8O1d1BaDUAr7l6A8cImkKcBuwcYm7weuA7Yk1D0MILcRaa63F7Nmzee+997jmmmvo2LEjY8aMYcyYMVx11VW89loaO/jMM89w8cUXM3HiRG644QZeeuklnnzySQ455BAuueQSAI4++mj2339/JkyYwD777MOxx6bkymOPPZZtttmGZ555hnHjxtGlSxcgLUO1//778/TTT7PGGmtwzjnnMHbsWCZMmMC///1vJkyYwLHHHsuqq67KI488wiOPPFKz30NLfGT6MHCupENtXwUgaRPgZeC3knaw/aCkpUmPI88vcYzrSFmgy2b7rwp8x3Yhc7Q78Hr2eSSwr6QHsxzRA4CKf+OSvg+0s71aruwcUud7XqHM9teSBgMnAg9Uep68CPcOIVRLIcbzgQceYMKECQwfPhyAadOm8fLLL7PkkkuyySabsMoqqwCw9tprz8kt3XDDDed0VKNHj+a2224D0pqKJ52UYpkffvhhhg5N8c3t2rWjY8eOfPzxx6yxxhpsvvnchYduueUWrrzySmbOnMk777zDc889R7du3ZrgN9AC7xCzTqkv8CNJkyVNAs4A3gZ2BU6V9CIwERhDifBt21+TOsuVs6IlgEGSXsgW7t0L+HW27UrSgJtnJD1Dmk4xKHe47SVNzf1sUU/T9yaNjs27NSsvdhWwZH2/gxBCaEqvvvoq7dq1Y+WVV8Y2l1xyCePHj2f8+PG89tprczq+pZZaas4+iy222Jzviy22GDNnzix57OJlporll5V67bXXGDRoEA899BATJkzgpz/96TxLUNVaS7xDxPbb1L/G4Lb17HMd6c6w8H0w8w5o2a6e/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OnTOeaYYxg7diySOP3009ljjz044ogjGDNmDDNmzGDPPfecs2ZjXV0dBxxwAHfffTfffPMN//jHP/je9763UL+L6BCrrIEc1voyUT8G9q1po0IIoYRZs2bx0EMPcfDB6d/gDzzwAC+//DJPPvkkttlll1149NFH+e53v8uLL77INddcw1ZbbcVBBx3E5ZdfPt/j0GITJkzgv//9L59//jk9evTgpz+t/x/wZ599Nh07dmTixIkAfPzxxwCcc845rLDCCsyaNYvtt9+eCRMmzFn9olOnTowbN47LL7+cQYMGcfXVVy/U7yMemYYQwiKmkGW64oor8tFHH/GjH/0ISB3iAw88QI8ePejZsycvvPACL7/8MgCrr776nGzRfffdl8cff7zR8+y6664svfTSdOrUid69e/Pkk0/WW/fBBx/kqKOOmvP9299Oy9Tecsst9OzZkx49ejBp0iSee+65OXV23313ADbeeGOmTJlS2S+hhOgQQwhhEVN4h/j666/z9ddfz3mHaJtTTjllztJPr7zyypy7x+JlnArfF198cWbPng0w31JN9e1Tiu35tje2HFRh+al27drVu/xUJaJDDCGERVTHjh0ZPHgwgwYN4ptvvmGnnXbi2muvZfr06QC89dZbvPfeewC88cYbjB49GoCbbrppzrJOdXV1PPVUmn596623znP8O++8ky+//JIPP/yQkSNHsskmm9Tblh133JFLL527vO3HH39ccjmoWop3iCGE0JyaOb+3R48ebLTRRnPWMHz++efZYou0DnqHDh3429/+Rrt27dhggw24/vrrOfzww1l33XU54ogjADj99NM5+OCDOffcc9lss83mOfamm27KT3/6U9544w1OO+00Vl111XofbZ566qkcddRRdO3alXbt2nH66aez++6717scVC20ueWfslGetwEbAEsAN2SbvgtMy34+BFYsUf6B7R0kdSEFbncmjfwcCvwhG0V6IDAQeAtoD/zV9oXZuc8ATgLqbL+XlU233SH7PAuYmGvuzcByQDvbv8nqrAE8AvS0/UlD19pr1XYee1iHSn9FYWFFAHlYCK1x+af83MHWpNLln9riHWJ/4HGgn+0zgO4Akq4DRtgenq9cXC5paeAu4AjbD0haBrgVOBIoTNYZZvtoSSsCL0oab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MMIYTQKmTB76OB9SVNlXQwsA9wsKRngEnArrld+gM3lxsCHtMuQgghBOIOMYQQQgCiQwwhhBCA6BBDCCEEIDrEEEIIAYgOMYQQQgCiQwwhhBCA6BBDCCEEAP4/TDDjZa65GS8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 把这些数据做成柱状图看起来更加清晰\n",
    "over_2mm.plot(kind='barh')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "cand_nm        contbr_occupation                     \n",
       "Obama, Barack  RETIRED                                   25305116.38\n",
       "               ATTORNEY                                  11141982.97\n",
       "               INFORMATION REQUESTED                      4866973.96\n",
       "               HOMEMAKER                                  4248875.80\n",
       "               PHYSICIAN                                  3735124.94\n",
       "               LAWYER                                     3160478.87\n",
       "               CONSULTANT                                 2459912.71\n",
       "Romney, Mitt   RETIRED                                   11508473.59\n",
       "               INFORMATION REQUESTED PER BEST EFFORTS    11396894.84\n",
       "               HOMEMAKER                                  8147446.22\n",
       "               ATTORNEY                                   5364718.82\n",
       "               PRESIDENT                                  2491244.89\n",
       "               EXECUTIVE                                  2300947.03\n",
       "               C.E.O.                                     1968386.11\n",
       "Name: contb_receipt_amt, dtype: float64"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 可能还像了解一下对 Obama 和 Romney 总出资额最高的职业和企业\n",
    "#  为此，先对候选人进行分组，然后使用类似 top 的方法\n",
    "\n",
    "def get_top_amounts(group, key, n=5):\n",
    "    totals = group.groupby(key)['contb_receipt_amt'].sum()\n",
    "    return totals.nlargest(n)\n",
    "\n",
    "# 然后根据职业和雇主进行聚合\n",
    "grouped = fec_mrbo.groupby('cand_nm')\n",
    "\n",
    "grouped.apply(get_top_amounts, 'contbr_occupation', n=7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "cand_nm        contbr_employer                       \n",
       "Obama, Barack  RETIRED                                   22694358.85\n",
       "               SELF-EMPLOYED                             17080985.96\n",
       "               NOT EMPLOYED                               8586308.70\n",
       "               INFORMATION REQUESTED                      5053480.37\n",
       "               HOMEMAKER                                  2605408.54\n",
       "               SELF                                       1076531.20\n",
       "               SELF EMPLOYED                               469290.00\n",
       "               STUDENT                                     318831.45\n",
       "               VOLUNTEER                                   257104.00\n",
       "               MICROSOFT                                   215585.36\n",
       "Romney, Mitt   INFORMATION REQUESTED PER BEST EFFORTS    12059527.24\n",
       "               RETIRED                                   11506225.71\n",
       "               HOMEMAKER                                  8147196.22\n",
       "               SELF-EMPLOYED                              7409860.98\n",
       "               STUDENT                                     496490.94\n",
       "               CREDIT SUISSE                               281150.00\n",
       "               MORGAN STANLEY                              267266.00\n",
       "               GOLDMAN SACH & CO.                          238250.00\n",
       "               BARCLAYS CAPITAL                            162750.00\n",
       "               H.I.G. CAPITAL                              139500.00\n",
       "Name: contb_receipt_amt, dtype: float64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "grouped.apply(get_top_amounts, 'contbr_employer', n=10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "411         (10, 100]\n",
       "412       (100, 1000]\n",
       "413       (100, 1000]\n",
       "414         (10, 100]\n",
       "415         (10, 100]\n",
       "             ...     \n",
       "701381      (10, 100]\n",
       "701382    (100, 1000]\n",
       "701383        (1, 10]\n",
       "701384      (10, 100]\n",
       "701385    (100, 1000]\n",
       "Name: contb_receipt_amt, Length: 694282, dtype: category\n",
       "Categories (8, interval[int64]): [(0, 1] < (1, 10] < (10, 100] < (100, 1000] < (1000, 10000] < (10000, 100000] < (100000, 1000000] < (1000000, 10000000]]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 对出资额分组\n",
    "\n",
    "# 还可以对该数据做另一件非常实用的分析\n",
    "#    利用 cut 函数根据出资额的大小将数据离散化到多个面元中\n",
    "\n",
    "import numpy as np\n",
    "\n",
    "bins = np.array([0, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000])\n",
    "\n",
    "labels = pd.cut(fec_mrbo.contb_receipt_amt, bins)\n",
    "\n",
    "labels"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>cand_nm</th>\n",
       "      <th>Obama, Barack</th>\n",
       "      <th>Romney, Mitt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>contb_receipt_amt</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>(0, 1]</th>\n",
       "      <td>493</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(1, 10]</th>\n",
       "      <td>40070</td>\n",
       "      <td>3681</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(10, 100]</th>\n",
       "      <td>372280</td>\n",
       "      <td>31853</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(100, 1000]</th>\n",
       "      <td>153991</td>\n",
       "      <td>43357</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(1000, 10000]</th>\n",
       "      <td>22284</td>\n",
       "      <td>26186</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(10000, 100000]</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(100000, 1000000]</th>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(1000000, 10000000]</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "cand_nm              Obama, Barack  Romney, Mitt\n",
       "contb_receipt_amt                               \n",
       "(0, 1]                         493            77\n",
       "(1, 10]                      40070          3681\n",
       "(10, 100]                   372280         31853\n",
       "(100, 1000]                 153991         43357\n",
       "(1000, 10000]                22284         26186\n",
       "(10000, 100000]                  2             1\n",
       "(100000, 1000000]                3             0\n",
       "(1000000, 10000000]              4             0"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 现在可以根据候选人姓名以及面元标签对 奥巴马 和 罗姆尼 数据进行分组，得到一个柱状图\n",
    "\n",
    "grouped = fec_mrbo.groupby(['cand_nm', labels])\n",
    "\n",
    "grouped.size().unstack(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>cand_nm</th>\n",
       "      <th>Obama, Barack</th>\n",
       "      <th>Romney, Mitt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>contb_receipt_amt</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>(0, 1]</th>\n",
       "      <td>0.805182</td>\n",
       "      <td>0.194818</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(1, 10]</th>\n",
       "      <td>0.918767</td>\n",
       "      <td>0.081233</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(10, 100]</th>\n",
       "      <td>0.910769</td>\n",
       "      <td>0.089231</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(100, 1000]</th>\n",
       "      <td>0.710176</td>\n",
       "      <td>0.289824</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(1000, 10000]</th>\n",
       "      <td>0.447326</td>\n",
       "      <td>0.552674</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(10000, 100000]</th>\n",
       "      <td>0.823120</td>\n",
       "      <td>0.176880</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(100000, 1000000]</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(1000000, 10000000]</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "cand_nm              Obama, Barack  Romney, Mitt\n",
       "contb_receipt_amt                               \n",
       "(0, 1]                    0.805182      0.194818\n",
       "(1, 10]                   0.918767      0.081233\n",
       "(10, 100]                 0.910769      0.089231\n",
       "(100, 1000]               0.710176      0.289824\n",
       "(1000, 10000]             0.447326      0.552674\n",
       "(10000, 100000]           0.823120      0.176880\n",
       "(100000, 1000000]         1.000000           NaN\n",
       "(1000000, 10000000]       1.000000           NaN"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 从这个数据中可以看出，在小额赞助方面，Obama 获得的数量比 Romney 多的多\n",
    "# 还可以对出资额求和并在面元内规格化、以便于图形化显示两位候选人各种赞助额度的比例\n",
    "\n",
    "bucket_sums = grouped.contb_receipt_amt.sum().unstack(0)\n",
    "\n",
    "normed_sums = bucket_sums.div(bucket_sums.sum(axis=1), axis=0)\n",
    "\n",
    "normed_sums"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x15dd1e08>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcYAAAD4CAYAAAB2ZUZAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deZgU1bnH8e/LhEUi6yBcApgBRSM6KDrgEqMQZDEKiBIVlcBFxbhEI4mRbMLVaFxjgphEE1HwJoIYRcBEWRwUFSJ4QVYNiJMwSkDZRGEMy3v/6DNjMczSDdNdM8Pv8zz90HXqVJ23S/H1VJ1zytwdERERSagTdwAiIiLViRKjiIhIhBKjiIhIhBKjiIhIhBKjiIhIxJfiDkAOTosWLTwnJyfuMEREapS33nrrY3c/oqx9Sow1XE5ODosWLYo7DBGRGsXM/lnePt1KFRERiVBiFBERiVBiFBERidAzRhGRCuzatYvCwkKKioriDkUOQIMGDWjbti1169ZN+hglRhGRChQWFtKoUSNycnIws7jDkRS4O5s2baKwsJD27dsnfZxupYqIVKCoqIjs7GwlxRrIzMjOzk65t6/EKCJSCSXFmutA/tnpVmpN9+FiGNMk7igya8y2uCMQkVpMPUYREZEIJUYRkUPUmDFjuP/+++MOo9pRYh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53bNo07hJSsWrWK4447bp8yM3vL3cucJ57WHqO7Lwbyiyf4x6kGJsV8oAOwK+5YREQOJWlfEs7dx6e7jdooTPAXkWqm/7jXq/R80274eqV1Nqz/gLt+egtrV7/L3r17OeucPoz86e3UrVeP55/+MyuWLuYnv7ivSuM6EDk5OTRq1IisrCz27NnDL37xCwYMGJC29ubOncv999/PjBkzKq+cAr1dQ0SkGnN3br76O/Tocx7T573FtFcXseOzz3jo3jviDq1M+fn5LFmyhGeeeYYbb7wxpWP37NlTeaUM0CLiNVxumyYsuvu8uMMQqbVWrVrFcWl8plbZ87o5c+bQvPGXue0H15eUTXj0Ydq3b89vf3UP7Zo3ZNGWjfzoqkt5//33ueyyyxg9ejQAF1xwAevWraOoqIibbrqJESNGAHD44Ydz/fXXM3v2bJo1a8Zdd93Fj370I/71r3/x61//mv79+1NQUMCQIUP47LPPABg3bhxnnHFG0r/rk08+oVmzZiXbFcUycuRIXnrpJR544AFefvllpk+fzs6dOznjjDN45JFHMDPWrFnDd7/7XT766COysrKYMmXKPu0tXLiQESNG8Je//IUOHQ7umbASo4hINbZixYr9Xg3VuHFjjjzySNasWQPAm2++yfLly2nYsCFdu3blvPPOIy8vj/Hjx9O8eXN27txJ165dueiii8jOzuazzz6je/fu3HPPPQwcOJCf/exnzJo1i5UrVzJ06FD69+9Py5YtmTVrFg0aNGD16tUMHjyYRYsqX765R48euDtr167l6aefLimvKJYTTjiB22+/HYBOnTpx2223ATBkyBBmzJhBv379uPzyyxk1ahQDBw6kqKiIvXv3sm5dYuGwN954g+9973s8//zzHHnkkQd9zZUYRUSqsbLeqlG6vFevXmRnZwOJ10S99tpr5OXlMXbsWJ57LjF1e926daxevZrs7Gzq1atH376Jdx/k5uZSv3596tatS25ubsnybrt27eKGG25gyZIlZGVl8Y9//COpePPz82nRogXvvfcePXv2pHv37hx++OHlxpKVlcVFF120z/H33nsvO3bsYPPmzRx//PF0796dDz74gIEDBwLQoMEXa8esWrWKESNGMHPmTL7yla+kcmnLpcQoIlKNHX/88fzlL3/Zp+yTTz5h3bp1HHXUUbz11lv7JU4zY+7cucyePZv58+fTsGFDunfvXvJaqrp165YcU94rox588EFatWrF22+/zd69e/dJRsk46qijaNWqFStXrmTHjh3lxtKgQQOyshITF4qKirjuuutYtGgR7dq1Y8yYMRQVFVHRtMLWrVtTVFTE4sWLqywxavCNiEg11rNnT3bs2MHEiROBxACVH/zgBwwbNqzkhcOzZs1i8+bN7Ny5k6lTp/L1r3+dbdu20axZMxo2bMg777zDggULKmpmP9u2baN169bUqVOHJ598cp+BMV/72tcqPX7jxo28//77fPWrX006luJk2aJFCz799FOeeeYZIHHruG3btkydOhWAzz//nB07dgDQtGlTXnjhBX7yk58wd+7clH5jedRjFBFJQUGGB7uZGc899xzXXXcdd9xxB3v37uVb3/oWd911V0mdM888kyFDhrBmzRouu+wy8vLyyM3N5fe//z2dO3fm2GOP5bTTTkup3euuu46LLrqIKVOm0KNHD7785S8D8PHHH1fYg+vRowdZWVns2rWLu+++m1atWtG3b9+kYmnatClXX301ubm55OTk0LVr15J9Tz75JNdccw233XYbdevW3WfwTatWrZg+fTrnnnsu48eP59RTD/SlSglpXflG0i8vL8+TeSAuIgemrFVTDmUzZsxg7dq1KU/FiFOqK9+oxygiIkk7//zz4w4h7fSMUUREJEKJUUREJEKJUUREJEKJUUREJEKJUUREJEKjUkVEUjGmSRWfb1ulVbKyssjNzWX37t20b9+eJ598kqZNa8bLgnNycmjXrh3z5s0rKTvppJPYvXs3y5cvZ9GiRUycOJGxY8cyd+5c6tWrV7JY+dSpUznmmGPo1KlTRmNWj1FEpJo77LDDWLJkCcuXL6d58+Y8/PDDcYeUku3bt5cs+L1q1ap99hWv6QqJ9yu+8cYbJfumTp3KypUrMxdooMQoIlKDnH766XzwwQdAYiHxW265hRNOOIHc3FwmT54MJBLM2WefzcUXX8wxxxzDqFGj+NOf/kS3bt3Izc3lvffeA2DYsGHceOONnHHGGXTo0KFkCTaA++67j65du9K5c+eS11j9/Oc/5ze/+U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m9iUStz42ZyS6eCRzTTCzc4CfAv3d/fMMxRanyq5LI+AEYK6ZFQCnAdNq+QCcZP/+PO/uu9z9fRIL83fMUHxxSOaaXAk8DeDu84EGJBYXr/WUGGuGhUBHM2tvZvVIDK6ZVqrONGBo+D4IeNnDU/NaqtJrEm4ZPkIiKdb2Z0bFKrwu7r7N3Vu4e46755B49trf3RfFE25GJPP3ZyqJwVqYWQsSt1bXZjTKzErmmvwL6AlgZseRSIwfZTTKmCgx1gDhmeENwEvAKuBpd19hZrebWf9Q7TEg28zWACOBcofp1wZJXpP7gMOBKWa2xMxK/8WvdZK8LoeUJK/JS8AmM1sJ5AO3uPumeCJOvySvyQ+Aq83sbeApYFgt/5/tEloSTkREJEI9RhERkQglRhERkQglRhERkQglRhERkQglRhERkQglRhERkQglRhERkYj/B4o9Nb4HmZmLAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "normed_sums[:-2].plot(kind='barh')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 排除两个最大的面元，这些不是由个人捐赠的\n",
    "\n",
    "# 还可以对该分析过程做许多的提炼和改进\n",
    "# 比如说，可以根据赞助人的姓名和邮编对数据进行聚合，以便于找出那些人进行了多次小额捐款"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>cand_nm</th>\n",
       "      <th>Obama, Barack</th>\n",
       "      <th>Romney, Mitt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>contbr_st</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AK</th>\n",
       "      <td>281840.15</td>\n",
       "      <td>86204.24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AL</th>\n",
       "      <td>543123.48</td>\n",
       "      <td>527303.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AR</th>\n",
       "      <td>359247.28</td>\n",
       "      <td>105556.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AZ</th>\n",
       "      <td>1506476.98</td>\n",
       "      <td>1888436.23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CA</th>\n",
       "      <td>23824984.24</td>\n",
       "      <td>11237636.60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CO</th>\n",
       "      <td>2132429.49</td>\n",
       "      <td>1506714.12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CT</th>\n",
       "      <td>2068291.26</td>\n",
       "      <td>3499475.45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DC</th>\n",
       "      <td>4373538.80</td>\n",
       "      <td>1025137.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DE</th>\n",
       "      <td>336669.14</td>\n",
       "      <td>82712.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FL</th>\n",
       "      <td>7318178.58</td>\n",
       "      <td>8338458.81</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "cand_nm    Obama, Barack  Romney, Mitt\n",
       "contbr_st                             \n",
       "AK             281840.15      86204.24\n",
       "AL             543123.48     527303.51\n",
       "AR             359247.28     105556.00\n",
       "AZ            1506476.98    1888436.23\n",
       "CA           23824984.24   11237636.60\n",
       "CO            2132429.49    1506714.12\n",
       "CT            2068291.26    3499475.45\n",
       "DC            4373538.80    1025137.50\n",
       "DE             336669.14      82712.00\n",
       "FL            7318178.58    8338458.81"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 根据州统计赞助信息\n",
    "\n",
    "# 根据候选人和州对数据进行聚合是常规操作\n",
    "\n",
    "grouped = fec_mrbo.groupby(['cand_nm', 'contbr_st'])\n",
    "\n",
    "totals = grouped.contb_receipt_amt.sum().unstack(0).fillna(0)\n",
    "\n",
    "totals = totals[totals.sum(1) > 100000]\n",
    "\n",
    "totals[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>cand_nm</th>\n",
       "      <th>Obama, Barack</th>\n",
       "      <th>Romney, Mitt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>contbr_st</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AK</th>\n",
       "      <td>0.765778</td>\n",
       "      <td>0.234222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AL</th>\n",
       "      <td>0.507390</td>\n",
       "      <td>0.492610</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AR</th>\n",
       "      <td>0.772902</td>\n",
       "      <td>0.227098</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AZ</th>\n",
       "      <td>0.443745</td>\n",
       "      <td>0.556255</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CA</th>\n",
       "      <td>0.679498</td>\n",
       "      <td>0.320502</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CO</th>\n",
       "      <td>0.585970</td>\n",
       "      <td>0.414030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CT</th>\n",
       "      <td>0.371476</td>\n",
       "      <td>0.628524</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DC</th>\n",
       "      <td>0.810113</td>\n",
       "      <td>0.189887</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DE</th>\n",
       "      <td>0.802776</td>\n",
       "      <td>0.197224</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FL</th>\n",
       "      <td>0.467417</td>\n",
       "      <td>0.532583</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "cand_nm    Obama, Barack  Romney, Mitt\n",
       "contbr_st                             \n",
       "AK              0.765778      0.234222\n",
       "AL              0.507390      0.492610\n",
       "AR              0.772902      0.227098\n",
       "AZ              0.443745      0.556255\n",
       "CA              0.679498      0.320502\n",
       "CO              0.585970      0.414030\n",
       "CT              0.371476      0.628524\n",
       "DC              0.810113      0.189887\n",
       "DE              0.802776      0.197224\n",
       "FL              0.467417      0.532583"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 如果对各行除以总赞助额，就会得到各个候选人在各个州的总赞助额比例\n",
    "percent = totals.div(totals.sum(1), axis=0)\n",
    "\n",
    "percent[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# summary\n",
    "# "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
